
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Rica
 */
public class ventasss {
public static void main(String[] args)   {



     Connection c;
        try {
            c = DriverManager.getConnection("jdbc:mysql://localhost/puntoventa", "root", "");

  Map mapa=new HashMap();
  mapa.put("nombre","yo");


       JasperReport reporte;

            reporte = JasperCompileManager.compileReport("reporte/report1.jrxml");

       JasperPrint print;

            print = JasperFillManager.fillReport(reporte, mapa, c);

       JasperViewer visor =new JasperViewer(print);
       visor.setVisible(true);
       } catch (SQLException ex) {
            Logger.getLogger(ventasss.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JRException ex) {
            Logger.getLogger(ventasss.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
